package JavaSE.d5;
//		编写一段代码，使代码在运行中报出强制类型转换异常
public class Test6 {
    public static void main(String[] args) {
        Animal dog1=new Dog();

        try {
            Cat cat = (Cat) dog1;
        }catch (ClassCastException e){
            System.out.println("类型转换异常");
            System.out.println("类型转换异常");
            System.out.println("类型转换异常");
            e.printStackTrace();
        }
    }
}

class Animal{
    public void voice(){
        System.out.println("嘤嘤怪");
    }
}
class Dog extends Animal{
    public void voice(){
        System.out.println("汪汪");
    }
    public void garenteen(){
        System.out.println("呜呜");
    }
}
class Cat extends Animal{
    public void voice(){
        System.out.println("喵喵");
    }
}